Decompiler: improve handling of garbage input#2527
Merged
sensei-hacker merged 1 commit intoiNavFlight:maintenance-9.xfrom Feb 21, 2026
Merged
Conversation
Problem: The decompiler was eagerly decompiling both operandA and operandB for all action operations, even when operandB was unused. This caused incorrect type-specific validation warnings for operations like SET_PROFILE (operation 42) which only uses operandA. Example: SET_PROFILE with operandB type=6 (PID), value=1700 (garbage data) would trigger: "Invalid PID operand value 1700. Valid range is 0-3." Solution: Added operation-specific operand handling with two categories: - operandAOnlyOperations: Operations that only use operandA (skip operandB decompilation) - noOperandOperations: Operations that use no operands (skip both) Additionally, added version detection warnings for unexpected operands: - Warns when unused operands have non-zero type or value - Helps detect firmware/configurator version mismatches - Shows operation name, type, and value for debugging Example warning: "Unexpected operand B to Set Profile operation (type=6, value=1700). This may indicate a firmware version mismatch." Benefits: - Prevents type-specific validation errors on garbage data in unused operands - Preserves validation for operations that legitimately use PID/other operands - Provides version detection when firmware adds new operand usage
Contributor
PR Compliance Guide 🔍All compliance sections have been disabled in the configurations. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User description
Summary
Improve handling of garbage logic lines that have been added via CLI.
Specifically, when an operator has too many operarands set, such as "set control profile, 1, 6, 1700"
Problem
The decompiler was eagerly decompiling both operandA and operandB for all action operations, even when operandB was unused. This caused incorrect type-specific validation warnings.
Example: SET_PROFILE (operation 42) only uses operandA for the profile number, but operandB contained garbage data (type=6/PID, value=1700), triggering:
Solution
Added operation-specific operand handling:
Additionally added version detection warnings for unexpected operands to detect firmware/configurator version mismatches when firmware adds new operand usage.
Changes
js/transpiler/transpiler/action_decompiler.js:operandAOnlyOperationsarray listing operations that only use operandAnoOperandOperationsarray listing operations that use no operandsExample new warning:
Benefits
Testing
PR Type
Bug fix
Description
Prevents incorrect validation warnings for unused operands in action operations
Adds operation-specific handling for operandA-only and no-operand operations
Implements version detection warnings for unexpected operand values
Skips decompilation of unused operands to avoid type-specific validation errors
Diagram Walkthrough
flowchart LR A["Action Operation"] --> B{"Operation Type?"} B -->|"No Operands"| C["Skip Both Operands"] B -->|"OperandA Only"| D["Skip OperandB"] B -->|"Both Operands"| E["Decompile Both"] C --> F["Check for Unexpected Values"] D --> F E --> G["Decompile Normally"] F --> H["Add Version Detection Warning"]File Walkthrough
action_decompiler.js
Add operation-specific operand handling and validationjs/transpiler/transpiler/action_decompiler.js
operandAOnlyOperationsarray listing 9 operations that only useoperandA
noOperandOperationsarray listing 7 operations that use nooperands
operands